package com.epcs.model.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.epcs.util.EpcsDateTimeUtil;
import com.google.gson.annotations.Expose;

public class NotificationList  implements Serializable{



	@Expose(deserialize=true, serialize=true)
	private List<NotificationItem> listOfNotification;
	@Expose(deserialize=true, serialize=true)
	private String username;



	
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public List<NotificationItem> getListOfNotification() {
		return listOfNotification;
	}

	public void setListOfNotification(List<NotificationItem> listOfNotification) {
		this.listOfNotification = listOfNotification;
	}

	public NotificationList(List<Notification> listOfNotification) {
		super();
		
		this.listOfNotification = new ArrayList<NotificationList.NotificationItem>();
		for (int i = 0; i < listOfNotification.size(); i++){
			Notification sourceItem = listOfNotification.get(i);
			NotificationItem output = new NotificationItem();
			
			output.setNotificationId(sourceItem.getNotificationId());
			output.setContent(sourceItem.getContent());
			output.setStatus(sourceItem.getStatus());
			output.setEventID(sourceItem.getFollowing().getIdOfFollow());
			output.setTypeOfNotification(sourceItem.getTypeOfNotification());
			String lastUpdated =EpcsDateTimeUtil.convertDateTimeWithPattern(sourceItem.getLastUpdated(), "HH'h'mm 'ngày' dd-MM-yyyy");
			output.setLastUpdated(lastUpdated);
			this.listOfNotification.add(output);
		}
	}

	public class  NotificationItem{
		
	    private Integer notificationId;
		@Expose(deserialize=true, serialize=true)
	    private Following following;
		@Expose(deserialize=true, serialize=true)
	    private String content;
		@Expose(deserialize=true, serialize=true)
		private int eventID;
		@Expose(deserialize=true, serialize=true)
		private String typeOfNotification;
		@Expose(deserialize=true, serialize=true)
		private String lastUpdated;
	
		public String getLastUpdated() {
			return lastUpdated;
		}
		public void setLastUpdated(String lastUpdated) {
			this.lastUpdated = lastUpdated;
		}
		public String getTypeOfNotification() {
			return typeOfNotification;
		}
		public void setTypeOfNotification(String typeOfNotification) {
			this.typeOfNotification = typeOfNotification;
		}
		public int getEventID() {
			return eventID;
		}
		public void setEventID(int eventID) {
			this.eventID = eventID;
		}
		public Integer getNotificationId() {
			return notificationId;
		}
		public void setNotificationId(Integer notificationId) {
			this.notificationId = notificationId;
		}
		public Following getFollowing() {
			return following;
		}
		public void setFollowing(Following following) {
			this.following = following;
		}
		public String getContent() {
			return content;
		}
		public void setContent(String content) {
			this.content = content;
		}
		public int getStatus() {
			return status;
		}
		public void setStatus(int status) {
			this.status = status;
		}
		@Expose(deserialize=true, serialize=true)
	    private int status;

		
		
	}
	
}
